#! /bin/sh
#
# build.sh
# Copyright (C) 2018 tim <tim@tim-notebook>
#
# Distributed under terms of the MIT license.
#


compile(){
    os=$1
    arch=$2
    exename='tadns'
    if [ "x$3" != "x" ]; then
        exename=$3
    fi
    CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -o dist/$os/$exename
    cp ./tadns.conf dist/$os/
    cp ./host.conf dist/$os/
}
rm -rf ./dist/
compile linux amd64
compile darwin amd64
compile windows 386 tadns.exe
